package priv.lirenhe.dissertation.executor;

import java.util.List;
import java.util.Map;

import priv.lirenhe.dissertation.component.search_engine.search_engine_executor.SearchEngineExecutor;


public class ComponentsExecutor {
	
	public static void execute(){
		ClawlerThread clawlerThread = new ClawlerThread();
		clawlerThread.startThread();
		
		GetAndCleanUpData getAndCleanUpData = new GetAndCleanUpData();
		getAndCleanUpData.putDataInMysqlDb();
	}
	
	
	public static List<Map<String,String>> getSearcherResult(String queryStr,int pageIndex){

		List<Map<String,String>> list_map_Value = null;
		list_map_Value = SearchEngineExecutor.searchWebPage(queryStr, pageIndex);
		if(list_map_Value != null && !list_map_Value.isEmpty()){
			for(Map<String,String> map_Value :list_map_Value){
				System.out.println(map_Value.get("webPageRealurl"));
				System.out.println(map_Value.get("webPageTitle"));
				System.out.println(map_Value.get("webPageContentText"));
			}
		}else{
			System.out.println("没有检索到");
		}
		
		return list_map_Value;
	}
	
	public static void main(String[] args) {
		ComponentsExecutor.execute();
	}
}


